| $x(t)$ | frequentie $\omega$ | periode $T$ |
|---|---|---|
| sin($t$) | $1$ | $2\pi$ |
| cos($3t$) | 3 | $2/3 \pi$ |
| sin(($1.5t$) | 1.5 | $4/3 \pi$ |
| sin($0.5t$) | 0.5 | $4 \pi$ |
| sin($\pi/3t$) | $\pi/3$ | 6 |
| sin($0.4t$) | 0.4 | $5\pi$ |
In [1]:
%matplotlib inline
from numpy import arange, sin, cos, pi
import matplotlib.pyplot as plt
def sinplot(omega, func=sin, a=1, offset=0, show=True):
T = 2*pi/omega
t = arange(0.0, T, 0.01)
plt.figure(figsize=(8, 8))
ax = plt.gca()
ax.set_xlim([0,(2*pi)/omega])
ax.set_ylim([a*-1.1, a*1.1])
for i, val in enumerate(ax.spines.values()):
if i % 2:
val.set_position('zero')
else:
val.set_position('center')
plt.plot(t, func(omega*t))
plt.draw()
plt.show()
sinplot(1)
sinplot(3, func=cos)
sinplot(1.5)
sinplot(0.5)
sinplot(pi/3)
sinplot(0.4)
In [2]:
%matplotlib inline
from numpy import arange, sin, cos, pi
import matplotlib.pyplot as plt
s = lambda omega, t: sin(omega*t)/omega
s1 = lambda t: s(1, t)
s3 = lambda t: s(3, t)
s5 = lambda t: s(5, t)
s7 = lambda t: s(7, t)
t = arange(0.0, 2*pi, 0.01)
plt.plot(s1(t))
plt.plot(s3(t))
plt.plot(s1(t) + s3(t))
plt.show()
plt.plot(s1(t))
plt.plot(s3(t))
plt.plot(s5(t))
plt.plot(s1(t) + s3(t) + s5(t))
plt.show()
plt.plot(s1(t))
plt.plot(s3(t))
plt.plot(s5(t))
plt.plot(s7(t))
plt.plot(s1(t) + s3(t) + s5(t) + s7(t))
plt.show()
total = 0
for i in range(1, 28, 2):
plt.plot(s(i, t))
total += s(i, t)
plt.plot(total)
plt.show()